<html xmlns:th="http://www.thymeleaf.org">

<th:block th:fragment="details">


  <!--'Add Funds' button-->
  <span th:if="${request.status.phase.name() == 'OPEN' and userClaimable.claimable == false}" th:remove="tag">

    <a th:unless="${platformIssue.status.name() eq 'CLOSED'}" class="btn btn-secondary mb-0" th:href="@{/requests/{id}/fund(id=${request.id})}" id="btnAddFunds">Add Funds</a>

    <span th:if="${platformIssue.status.name() eq 'CLOSED'}"
          id="not-fundable" class="d-inline-block" tabindex="0" data-toggle="tooltip" title="It is not possible to add funds because this issue is closed on GitHub">
      <a href="" class="btn btn-secondary mb-0 disabled">Add Funds</a>
    </span>
  </span>


  <!-- Claim Funds button-->
  <span id="not-claimable" class="d-inline-block" tabindex="0" data-toggle="tooltip"
        th:attrappend="title=${isAuthenticated ? 'You are not the solver of the issue' : 'You need to sign in first'}"
        th:if="${userClaimable.claimable == true and userClaimable.claimableByLoggedInUser == false}">
    <a href="" class="btn btn-success mb-0 disabled">
      Claim Funds
    </a>
  </span>

  <form th:action="@{/requests/{id}/claim(id=${request.id})}" method="post" th:if="${userClaimable.claimableByLoggedInUser}">
    <input
        type="hidden"
        th:name="${_csrf.parameterName}"
        th:value="${_csrf.token}"/>
    <input
        type="hidden"
        th:name="platform"
        th:value="${platformIssue.platform}"/>
    <input
        type="hidden"
        th:name="platformId"
        th:value="${platformIssue.platformId}"/>

    <select th:name="address">
      <option th:each="w : ${profile.getWallets()}" th:value="${w.address}" th:text="${w.description}"></option>
    </select>

    <button type="submit" class="btn btn-success mb-0">Claim Funds</button>
  </form>

</th:block>


</html>